class RedstoneRepeaterRenderer : public IBlockRenderer
{
public:
	ITexture *Texture;
	Point2i TexturePosition;

	RedstoneRepeaterRenderer(ITexture *texture, const Point2i &pos) :
		Texture(texture),
		TexturePosition(pos)
	{
	}

	int GetTypeData(const int &data) { return 0; }

	void DrawTorch(RendererBase *renderer)
	{
		renderer->Draw(Box(Texture, Point3i(4, 6, 4), Point3i(2, 0, 2)).SetAll(Point2i(54, 101)).SetSidesInset(1).SetTopInset(1));
	}

	void Render(Schematic *schematic, RendererBase *renderer, const Block &block, const Point3i &position)
	{
		byte face = (byte)(block.Data & (0x01 | 0x02));
		byte tick = (byte)(block.Data & (0x04 | 0x08));
		
		renderer->Translate(8, 8, 8);
		switch (face)
		{
		case 0:
			break;
		case 1:
			renderer->Rotate(-90, 0, 1, 0);
			break;
		case 2:
			renderer->Rotate(180, 0, 1, 0);
			break;
		case 3:
			renderer->Rotate(90, 0, 1, 0);
			break;
		}
		renderer->Translate(-8, -8, -8);
		
		renderer->Translate(4, 8, -1);
		DrawTorch(renderer);

		byte ticks;

		if ((tick & 0xC) == 0xC)
			ticks = 3;
		else if ((tick & 0x8) == 0x8)
			ticks = 2;
		else if ((tick & 0x4) == 0x4)
			ticks = 1;
		else
			ticks = 0;

		int offs = 4 + (ticks * 2);
		renderer->Translate(0, 0, offs);
		DrawTorch(renderer);
		renderer->Translate(0, 0, -offs);

		renderer->Translate(-4, -8, 1);

		renderer->Draw(Box(Texture, Point3i(16, 2, 16), Point3i(0, 14, 0)).SetCoordsFromBounds(TexturePosition));
	}
};